<template>
	<view class="childpage">
		<view class="userBox">
			<view class="listItem" v-for="(i,index) in list">
				<view class="item">
					<view>提现单号：<text style="color:#666;">{{i.id}}</text></view>
					<view>状态：
						<text v-if="i.state == '2'" style="color:#37c18a;">{{i.state_text}}</text>
						<text v-if="i.state == '3'" style="color:red;">{{i.state_text}}</text>
						<text v-if="i.state == '1'" style="color:#ff537b;">{{i.state_text}}</text>
						<!-- <text v-if="i.state == '2'" style="color:#000;">{{i.state_text}}</text> -->
					</view>
				</view>
				<view class="item">
					<view>提现金额：<text style="color:#ff537b;font-weight: bold;">{{i.money}}</text></view>
					<view>
						<text>提现方式：</text>
						<text v-if="i.type == '3'" style="color:#666;">微信</text>
						<text v-if="i.type == '2'" style="color:#666;">支付宝</text>
						<text v-if="i.type == '1'" style="color:#666;">银行卡</text>
					</view>
				</view>
				<view class="item">
					<view>
						<text>{{i.type == '1'?'开户人：':'姓名：'}}</text>
						<text style="color:#666;">{{i.collect_info.account}}</text>
					</view>
					<view>
						<text>{{i.type == '1'?'银行卡号：':'账号：'}}</text>
						<text style="color:#666;">{{i.type == '1'?i.collect_info.bank_num:i.collect_info.phone}}</text>
					</view>
				</view>
				<view class="item">
					<view>时间：<text style="color:#666;">{{i.create_time}}</text></view>
				</view>
				<!-- <view class="item" v-if="i.content.reject_content">
					<view>驳回原因：<text style="color:#666;">{{i.content.reject_content}}</text></view>
				</view> -->
			</view>
			<view class="hasmore">{{hasmore?'加载中':'没有更多了'}}</view>
		</view>

	</view>
</template>

<script>
	import {
		get,
		formatDate
	} from "@/utils/post";
	export default {
		data() {
			return {
				list: [],
				hasmore: false,
				page: 1,
				limit: 20,
				status_name: ''
			}
		},
		onLoad(op) {
			this.btype = op.btype
			this.init()
		},
		filters: {
			keepFour(num) {
				return num.substring(num.length - 4)
			},
			formatdate(time) {
				return formatDate(time * 1000, 'yyyy-MM-dd hh:mm')
			}
		},
		methods: {
			init() {
				var data = {
					page: this.page,
					limit: this.btype,
					b_type: this.btype
				}
				this.$request({
					url: this.$api.wallet.withdrawal_list,
					method: 'post',
					data: data
				}).then(info => {
					this.page++
					if (info.code == 0) {
						info.data.map(item => {
							item.collect_info = JSON.parse(item.collect_info)
						})
						this.list = this.list.concat(info.data)
						this.hasmore = info.data.length == this.limit
					}
				}).catch(info => {})
			}
		},
		onReachBottom() {
			if (this.hasmore) {
				this.init()
			}
		}
	}
</script>

<style scoped lang="less">
	.listItem {
		width: 100%;
		border-bottom: 1px solid #707070;
		margin-bottom: 20upx;
		padding-bottom: 20upx;
		font-size: 28upx;
		color: #000;
	}

	.item {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		height: 50upx;
	}

	.cmoney {
		color: #ff537b;
		border: 1px solid #ff537b;
	}

	.userBox {
		padding: 20upx 20upx;
		box-sizing: border-box;
		background: #fff;
		box-shadow: 0px 0px 5px #aaa;
		width: 700upx;
		border-radius: 10upx;
		margin-top: 30upx;
		margin-bottom: 50upx;
	}

	.childpage {
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 1px;
	}
</style>
